package com.hc.bankonline.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hc.bankonline.services.BankOnlineservices;
import com.hc.bankonline.services.BankOnlineservicesImpl;

public class BankOnlineBalanceServlet extends HttpServlet {

	private static final long serialVersionUID = -8607288170126627945L;
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		this.doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		
		String i = request.getParameter("id");
		if(i == null){
			i = "0";
		}
		int id = Integer.valueOf(i);
		
		BankOnlineservices bankOnlineBiz = new BankOnlineservicesImpl();
		int banlance = bankOnlineBiz.findBalanceInfo(id);
		
		request.getRequestDispatcher("checkbalance.jsp").forward(request, response);
		
		
	}

}
